package com.bwie.poi;

/**
 * 工具类异常
 * 
 * @author ruoyi
 */
public class UtilException extends RuntimeException
{
    private static final long serialVersionUID = 8247610319171014183L;

    public UtilException(Throwable e)
    {
        super(e.getMessage(), e);
    }

    public UtilException(String message)
    {
        super(message);
    }

    public UtilException(String message, Throwable throwable)
    {
        super(message, throwable);
    }
}

































//    @ApiOperation("登录菜单栏")
//    @PostMapping("/loginMenu")
//    public R LoginMenu(){return tbUserService.loginMenu();}
//
// @Autowired
//    HttpServletRequest request;
//         String token = request.getHeader("token");
//        Claims claims = Jwts.parser().setSigningKey("123456").parseClaimsJws(token).getBody();
//        Long userId = claims.get("userId", Long.class);
//        List<TbMenu> menus= tbMenuMapper.getById(userId);
//        List<Tree<String>> treeList = TreeUtil.build(menus, "0", (node, tree) -> {
//            tree.setId("" + node.getMenuId());
//            tree.setName("" + node.getMenuName());
//            tree.setParentId("" + node.getMenuPid());
//            tree.putExtra("path",node.getMenuPath());
//        });
//        return R.OK(treeList);}

// SELECT m.* FROM tb_user u
//                LEFT JOIN tb_user_role ur ON u.user_id = ur.user_id
//                LEFT JOIN tb_role_menu rm ON ur.role_id = rm.role_id
//                LEFT JOIN tb_menu m ON rm.menu_id = m.menu_id where u.user_id=#{userId}


//  @ApiOperation("修改回显")
//    @PostMapping("/updateUser")
//    public R updateUser(@RequestBody TbUser tbUser){return tbUserService.updateUser(tbUser);}
//    @Override
//    public R updateUser(TbUser tbUser) {
//        TbUser tbUser1 = tbUserMapper.selectById(tbUser.getUserId());
//        if (tbUser1==null) {return R.ERROR(404,"用户不存在");}
//        tbUserMapper.updateById(tbUser);return R.OK();}

//    @ApiOperation("删除")
//    @PostMapping("/deleteUser/{userId}")
//    public R deleteUser(@PathVariable("userId")Integer userId){return tbUserService.deleteUser(userId);}
//    @Override
//    public R deleteUser(Integer userId) {
//        TbUser tbUser = tbUserMapper.selectById(userId);
//        if (tbUser==null) {return R.ERROR(404,"用户不存在");}tbUserMapper.deleteById(userId);return R.OK();}
//
//    @ApiOperation("批量删除")
//    @PostMapping("/deleteUserAll")
//    public R deleteUserAll(@RequestBody List<TbUser> userList){return tbUserService.deleteUserAll(userList);}

//    @Override
//    public R deleteUserAll(List<TbUser> userList) {
//        for (TbUser tbUser : userList) {tbUserMapper.deleteById(tbUser.getUserId());}return R.OK();}


//    @ApiOperation("图片上传")
//    @PostMapping("/updateImage")
//    public R updateImage(@RequestPart("file") MultipartFile file) {return tbUserService.updateImage(file);}
//  public R updateImage(MultipartFile file) {
//        try {   String extName = FileNameUtil.extName(file.getOriginalFilename());
//            StorePath storePath = fastFileStorageClient.uploadFile(file.getInputStream(), file.getSize(), extName, null);
//            if (storePath==null) {
//            return R.ERROR(500,"上传失败"); }
//            String url="http://192.168.80.192:8888/"+storePath.getFullPath();
//            return R.OK(url); } catch (IOException e) {e.printStackTrace(); return R.ERROR(500,"上传失败");}}


//    @ApiOperation("图片")
//    @GetMapping("/imageCode")
//    public void imageCode(HttpServletResponse response){tbUserService.imageCode(response);}
//    @ApiOperation("发送手机验证码")
//    @PostMapping("/sendCode")
//    public R sendCode(@RequestBody PhoneVo phoneVo){return tbUserService.sendCode(phoneVo);}
//    @ApiOperation("手机登录")
//    @PostMapping("/shoppingLogin")
//    public R shoppingLogin(@RequestBody PhoneVo phoneVo){return tbUserService.shoppingLogin(phoneVo);}
//    @Override
//    public void imageCode(HttpServletResponse response) {
//        String code = RandomUtil.randomNumbers(4);
//        String key=code;String value=code;
//        stringRedisTemplate.opsForValue().set(key,value,1,TimeUnit.MINUTES);
//        KaptchaUtils.generateCaptcha(response,code);  }
//
//    @Override
//    public R sendCode(PhoneVo phoneVo) {
//        String key=phoneVo.getImageCode();        Boolean hasKey = stringRedisTemplate.hasKey(key);
//        if (!hasKey) { return R.ERROR(500,"图形验证码已过期");}
//        String code=RandomUtil.randomNumbers(4);String mobile = phoneVo.getMobile();
//        stringRedisTemplate.opsForValue().set(mobile,code,5,TimeUnit.MINUTES);  System.out.println(code);
//        MobileMessageUtil.sendMobileMessage(mobile,code);  return R.OK();}
//    @Override
//    public R shoppingLogin(PhoneVo phoneVo) {
//        String key = phoneVo.getMobile();    String code = stringRedisTemplate.opsForValue().get(key);
//        if (code==null) {return R.ERROR(500,"手机验证码过期了");}
//        if (!code.equals(phoneVo.getMobileCode())) {return R.ERROR(500,"手机验证码错了");}
//        TbUser tbUser = tbUserMapper.selectOne(new QueryWrapper<TbUser>().lambda().eq(TbUser::getUserMobile, phoneVo.getMobile()));
//        if (tbUser==null) {return R.ERROR(500,"用户不存在");}
//        String token = Jwts.builder().signWith(SignatureAlgorithm.HS256, "123456")
//                .claim("userId", tbUser.getUserId())
//                .claim("userName", tbUser.getUserName())
//                .claim("nickName", tbUser.getNickName()).compact();
//        String tokenKey = "token:" + tbUser.getUserId();
//        stringRedisTemplate.opsForValue().set(tokenKey,token,60,TimeUnit.MINUTES);
//        tbUser.setUserPass(null);        tbUser.setToken(token);        return R.OK(tbUser);}
//    @Autowired StringRedisTemplate stringRedisTemplate;
//    @Autowired HttpServletRequest request;
//    @Autowired KafkaTemplate kafkaTemplate;

//    @Autowired FastFileStorageClient fastFileStorageClient;
//    @Import(FdfsClientConfig.class)

//@TableField(exist = false)  @NotBlank(message = "头像不能为空")
// @NotNull(message = "时间不能为空") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")